#define _CRT_SECURE_NO_WARNINGS   1

#include<iostream>
#include<string>
#include<queue>
using namespace std;
int main()
{
	int c;
	int loop;
	cin >> c;
	cin >> loop;
	queue<int>q;
	int index;
	int num;
	string s;
	for (int i = 0; i<loop; i++)
	{
		cin >> s;
		if (s == "push") index = 0;
		if (s == "front") index = 1;
		if (s == "pop") index = 2;
		switch (index)
		{
		case 0:
			cin >> num;
			if (q.size() >= c) cout << "full" << endl;
			else  q.push(num);
			break;
		case 1:
			if (q.empty())  cout << "empty" << endl;
			else cout << q.front() << endl;
			break;
		case 2:
			if (q.empty())  cout << "empty" << endl;
			else
			{
				cout << q.front() << endl;
				q.pop();
			}
			break;
		}
	}
	return 0;
}